/*
 *  Copyright 2009 Utkin Dmitry
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
 
/* 
 *  This file is part of the WSF Staff project.
 *  Please, visit http://code.google.com/p/staff for more information.
 */

// This file generated by staff_codegen
// Service Implementation

#ifndef _FileUploaderImpl_h_
#define _FileUploaderImpl_h_

#include <map>
#include <rise/process/Process.h>
#include "FileUnpacker.h"
#include "FileUploader.h"

namespace webapp
{
  namespace admin
  {
    class CFileUploaderImpl: public CFileUploader
    {
    public:
      CFileUploaderImpl();
      virtual ~CFileUploaderImpl();
      virtual void Move(const std::string& sFileName, const std::string& sPathTo);
      virtual void Unpack(const std::string& sFileName, const std::string& sPathTo);
      virtual int GetUnpackingStatus();
      virtual TStringList GetUnpackedFiles(const std::string& sMask);
      virtual void Delete(const std::string& sFileName);

    private:
      void GetUnpackedFiles(const std::string& sMask, TStringList& rFiles, const std::string& sRelativeDir = "");

    private:
      static const std::string m_sUploadDir;
      typedef std::map<std::string, std::string> TStringMap;
      static TStringMap m_mUnpackers;
      std::string m_sLastSaveToDir;
      CFileUnpacker m_tUnpacker;
    };
  }
}


#endif // _FileUploaderImpl_h_
